<template>
  <keep-alive>
    <component :is="componentName" @menu-select="menuSelect" />
  </keep-alive>
</template>

<script>
  import headquartersBusinessBalanceIndex from './index'

  import {  
    mapGetters
  } from 'vuex'
  export default {
    name: 'headquartersBusinessBalanceAllIndex',
    components: {
      headquartersBusinessBalanceIndex,

    },
    props: {},
    data() {
      return {
        componentName: ''
      }
    },
    computed: {
      ...mapGetters(['crm'])
    },
    watch: {},
    mounted() {
      console.log(this.crm)
      if (this.crm && this.crm.headquartersBusinessBalance) {
        this.componentName = 'headquartersBusinessBalanceIndex'
      }
    },

    beforeDestroy() {},
    methods: {
      /**
       * 左侧菜单选择
       */
      menuSelect(key, keyPath) {
        consoloe.log(key);
        this.componentName = {
          headquartersBusinessBalance: 'headquartersBusinessBalanceIndex',
        } [key]
      }
    }
  }
</script>

<style lang="scss" scoped>
</style>
